{# The pieces a container's line is made of, shared by its card (_container_cards.html), a page's glance (_glance_rows.html) and Overseer's home (_overview_*.html). #} {% from "components/macros/form.html" import action %} {% from "components/macros/layout.html" import badge, progress %} {% macro state(row) -%} {{ badge(row.state, row.tone) }} {%- endmacro %} {% macro uptime(row) -%} up {{ row.uptime }} {%- endmacro %} {# Its Restart, which confirms first. #} {% macro restart(row) -%} {{ action("Restart", hx_dialog(row.restart_url), "warn") }} {%- endmacro %} {# A live figure past its threshold takes its tone (``tone`` in input.css): amber from a warning, red at the alert. #} {% macro cpu(row) -%} {{ figure_names.cpu }}{{ row.cpu }} {%- endmacro %} {# Memory as a share of its limit: a bar and the percent, in its tone (the host's memory check's rule); the amount where there is no limit. Short of room (a map node), the bar gives way so the percent stays. #} {% macro memory(row) -%} {{ figure_names.memory }} {%- if row.memory_percent is not none %} {{ progress(row.memory_percent / 100, row.memory_tone, figure_names.memory, "h-1.5") }}{{ row.memory_percent }}% {%- else %}{{ row.memory_used }}{% endif %} {%- endmacro %} {# Its CPU and memory, or, stopped, its state (where nothing else says it). #} {% macro figures(row) -%} {% if row.phase == "running" %}{{ cpu(row) }}{{ memory(row) }}{% else %}{{ state(row) }}{% endif %} {%- endmacro %} {# A failing entry's failing dependencies (``topology.causes``), named. #} {% macro cause(item) -%} {% if item.cause %}Likely cause: {{ item.cause }}{% endif %} {%- endmacro %} {# The way to a page's Container and Logs sections (``base``: its URL). #} {% macro links(base) -%} {% set link = "text-xs text-aegis-muted hover:text-aegis-teal" %} Container Logs {%- endmacro %} {# Its Restart (which confirms first), and the ``links``. #} {% macro actions(row, base) -%} {{ restart(row) }}{{ links(base) }} {%- endmacro %}